package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.jianchuanghua.JianChuangHuaMgr;
import com.yanqu.road.server.manger.activity.suoyao.SuoYaoMgr;
import com.yanqu.road.server.manger.activity.tanghulu.TangHuLuMgr;

import java.util.ArrayList;
import java.util.List;

public class TangHuLuRecycleStrategy extends AbstractItemRecycleStrategy {
    @Override
    public void markNeedRecycleItem() {
        ActivityInfo activityInfo = TangHuLuMgr.getActivityInfo();
        if (activityInfo != null) {
            addRecycleItemData(activityInfo,TangHuLuMgr.TANGHULU_CARAMBOLA_ID);
            addRecycleItemData(activityInfo,TangHuLuMgr.TANGHULU_HAWTHORN_ID);
            addRecycleItemData(activityInfo,TangHuLuMgr.TANGHULU_KIWIFRUIT_ID);
            addRecycleItemData(activityInfo,TangHuLuMgr.TANGHULU_STRAWBERRY_ID);
        }
    }

    @Override
    public boolean isActivityRunning() {
        ActivityInfo activityInfo = TangHuLuMgr.getActivityInfo();
        return ActivityMgr.activityInTime(activityInfo);
    }

    private void addRecycleItemData(ActivityInfo activityInfo,int itemId) {
        List<String> paramList = new ArrayList<>();
        long recycleTime = activityInfo.getEndTime() * 1000L + 600 * 1000;
        paramList.add(String.valueOf(itemId));
        paramList.add(String.valueOf(TangHuLuMgr.SCORE_GOODS_ID));
        paramList.add("1");
        paramList.add(activityInfo.getActivityName());
        ActivityItemRecycleMgr.addRecycleItemData(itemId, activityType, 0, recycleTime, paramList);
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.TangHuluActivity.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        item2Score(userId, data);
    }


}
